﻿using DevExpress.Utils;
using DevTeam;

using System;
using System.Drawing;

namespace ConfExpert.Forms.Depo._7C
{
    public partial class BedenDagilimTrendiModel : XPopupForm
    {
        string model, linea;
        public BedenDagilimTrendiModel(string model, string linea)
        {
            InitializeComponent();
            this.model = model;
            this.linea = linea;
            txtInfo.Caption = model;
        }

        private void BedenDagilimTrendiModel_Load(object sender, EventArgs e)
        {
            gridView1.Init("Get7cBedenler", 30, model);
            gridView1.FormatAsNumber(1, "B01", "B02", "B03", "B04", "B05", "B06", "B08", "B10", "B12", "D38", "D40", "D42", "D44", "D46", "D48", "D50", "D52", "D54", "D56", "D58", "D60", "U36", "U37", "U38", "U39", "U40", "U41", "U42", "U43", "U44", "U45", "U46", "U47", "U48", "U49", "U50", "U51", "U52", "U53", "U54");
            gridView1.FormatAsNumber(0, "Total");
            gridView1.AddSummary("Total");
            gridView1.MakeReadOnly();
            switch(linea)
            {
                case "BAMBINO": gridView1.MakeColumnInvisible("D38", "D40", "D42", "D44", "D46", "D48", "D50", "D52", "D54", "D56", "D58", "D60", "U36", "U37", "U38", "U39", "U40", "U41", "U42", "U43", "U44", "U45", "U46", "U47", "U48", "U49", "U50", "U51", "U52", "U53", "U54"); break;
                case "DONNA": gridView1.MakeColumnInvisible("B01", "B02", "B03", "B04", "B05", "B06", "B08", "B10", "B12", "U36", "U37", "U38", "U39", "U40", "U41", "U42", "U43", "U44", "U45", "U46", "U47", "U48", "U49", "U50", "U51", "U52", "U53", "U54"); break;
                case "UOMO": gridView1.MakeColumnInvisible("B01", "B02", "B03", "B04", "B05", "B06", "B08", "B10", "B12", "D38", "D40", "D42", "D44", "D46", "D48", "D50", "D52", "D54", "D56", "D58", "D60"); break;
            }
            gridView1.RowCellStyle += gridView1_RowCellStyle;
            gridView1.BestFitColumns();
        }

        void gridView1_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
        {
            if (e.Column.FieldName.EndsWith("Model"))
                e.Appearance.Font = new Font(AppearanceObject.DefaultFont, FontStyle.Bold);
        }
    }
}
